#! /usr/bin/python3
# _*_ coding:UTF-8 _*_
"""
    类和实例
"""


class Student(object):
    def __init__(self, name, num, score):
        self.name = name
        self.num = num
        self.score = score

    def leaning(self):
        print(self.name + ' is leaning!')

    def print_score(self):
        print('%s的num是%d' % (self.name, self.num))
        print('%s的score是%d' % (self.name, self.score))

    def get_grade(self):
        if self.score >= 90:
            return 'A'
        elif self.score >= 60:
            return 'B'
        else:
            return 'C'


def main():
    print(Student)
    bart = Student('wangnan', 20, 90)
    print(bart)
    print(bart.name, bart.num)
    bart.leaning()
    bart.print_score()
    print('%s成绩是%s' % (bart.name, bart.get_grade()))
    # 新增绑定变量，类的实例可以绑定任意变量到实例
    lisa = Student('lisa', 22, 96)
    lisa.age = 15
    print('lisa的年龄是：', lisa.age)


if __name__ == '__main__':
    main()
